<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /* 通过Date的构造函数创建对象 */
        var now = new Date();//获取的当前的日期相关
        var now1 = new Date("2020/01/01"); //指定具体日期

        //通过对象调用方法获得指定值
        var year = now.getFullYear() + "年";
        var month = now.getMonth() + 1 + "月";
        var day = now.getDate() + "日";
        var hour = now.getHours() + "时";
        var minutes = now.getMinutes() + "分";
        var seconds = now.getSeconds() + "秒";

        console.log(year + month + day + hour + minutes + seconds);
        document.write(year + month + day + hour + minutes + seconds);


    </script>
</head>

<body>

</body>

</html>